

package com.hazelcast.core;

import com.hazelcast.cluster.Member;

/**
 * ExecutionCallback allows to asynchronously get notified when the execution is completed,
 * either successfully or with error.
 *
 * @param <V> value
 * @see IExecutorService#submit(java.util.concurrent.Callable, ExecutionCallback)
 * @see IExecutorService#submitToMember(java.util.concurrent.Callable, Member, ExecutionCallback)
 * @see IExecutorService#submitToKeyOwner(java.util.concurrent.Callable, Object, ExecutionCallback)
 */
public interface ExecutionCallback<V> {

    /**
     * Called when an execution is completed successfully.
     *
     * @param response the result of the successful execution
     */
    void onResponse(V response);

    /**
     * Called when an execution is completed with an error.
     *
     * @param t the exception that is thrown
     */
    void onFailure(Throwable t);
}
